SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE procedure [dbo].[sp_MSupd_tb_Divisionestemp] 
 @c1 int,@c2 varchar(50),@c3 int,@c4 varchar(50),@c5 varchar(1),@c6 varchar(5),@c7 varchar(13),@c8 int,@c9 int,@c10 datetime,@c11 varchar(1),@c12 datetime,@c13 int,@c14 varchar(1),@c15 int,@c16 char(20),@c17 datetime,@c18 int,@pkc1 int
,@bitmap binary(3)
as
SET NOCOUNT ON
if substring(@bitmap,1,1) & 1 = 1
begin
update "tb_Divisionestemp" set
"idDivision" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "idDivision" end
,"Mnemo" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "Mnemo" end
,"idSubOrg" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "idSubOrg" end
,"Descripcion" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "Descripcion" end
,"EsGrupo" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "EsGrupo" end
,"Curso" = case substring(@bitmap,1,1) & 32 when 32 then @c6 else "Curso" end
,"Division" = case substring(@bitmap,1,1) & 64 when 64 then @c7 else "Division" end
,"GrupoCarreras" = case substring(@bitmap,1,1) & 128 when 128 then @c8 else "GrupoCarreras" end
,"Turno" = case substring(@bitmap,2,1) & 1 when 1 then @c9 else "Turno" end
,"FechaAlta" = case substring(@bitmap,2,1) & 2 when 2 then @c10 else "FechaAlta" end
,"Baja" = case substring(@bitmap,2,1) & 4 when 4 then @c11 else "Baja" end
,"FechaBaja" = case substring(@bitmap,2,1) & 8 when 8 then @c12 else "FechaBaja" end
,"CUISE" = case substring(@bitmap,2,1) & 16 when 16 then @c13 else "CUISE" end
,"EsPrivada" = case substring(@bitmap,2,1) & 32 when 32 then @c14 else "EsPrivada" end
,"Divpriv" = case substring(@bitmap,2,1) & 64 when 64 then @c15 else "Divpriv" end
,"cargo" = case substring(@bitmap,2,1) & 128 when 128 then @c16 else "cargo" end
,"hora" = case substring(@bitmap,3,1) & 1 when 1 then @c17 else "hora" end
,"divreal" = case substring(@bitmap,3,1) & 2 when 2 then @c18 else "divreal" end
where "idDivision" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
else
begin
update "tb_Divisionestemp" set
"Mnemo" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "Mnemo" end
,"idSubOrg" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "idSubOrg" end
,"Descripcion" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "Descripcion" end
,"EsGrupo" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "EsGrupo" end
,"Curso" = case substring(@bitmap,1,1) & 32 when 32 then @c6 else "Curso" end
,"Division" = case substring(@bitmap,1,1) & 64 when 64 then @c7 else "Division" end
,"GrupoCarreras" = case substring(@bitmap,1,1) & 128 when 128 then @c8 else "GrupoCarreras" end
,"Turno" = case substring(@bitmap,2,1) & 1 when 1 then @c9 else "Turno" end
,"FechaAlta" = case substring(@bitmap,2,1) & 2 when 2 then @c10 else "FechaAlta" end
,"Baja" = case substring(@bitmap,2,1) & 4 when 4 then @c11 else "Baja" end
,"FechaBaja" = case substring(@bitmap,2,1) & 8 when 8 then @c12 else "FechaBaja" end
,"CUISE" = case substring(@bitmap,2,1) & 16 when 16 then @c13 else "CUISE" end
,"EsPrivada" = case substring(@bitmap,2,1) & 32 when 32 then @c14 else "EsPrivada" end
,"Divpriv" = case substring(@bitmap,2,1) & 64 when 64 then @c15 else "Divpriv" end
,"cargo" = case substring(@bitmap,2,1) & 128 when 128 then @c16 else "cargo" end
,"hora" = case substring(@bitmap,3,1) & 1 when 1 then @c17 else "hora" end
,"divreal" = case substring(@bitmap,3,1) & 2 when 2 then @c18 else "divreal" end
where "idDivision" = @pkc1
if @@rowcount = 0
	if @@microsoftversion>0x07320000
		exec sp_MSreplraiserror 20598
end
GO
